<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php


class MSharesController
extends MApplicationComponent
implements MIController
{
    private $_root = null;
    
    public function invoke($uri=null)
    {
                                parent::init();
        $params = $_REQUEST;
                if (isset($params) === false) {
            throw new MException(FXP::t('Invalid parameters'));
        }
                                $path           = MUtils::convertStandardPath($path);
        $url            = $uri;
        $parts          = array_slice(explode('/', $url), 3);
        $root           = $parts[0];
        
        $path               = null;
        foreach ($parts as $key => $name)
        { 
            $path .= "/{$name}";
        }
                                if ($pos = strpos($root, '?'))
        {
            $root = substr($root, 0, $pos);
        }
        if ($pos = strpos($path, '?'))
        {
            $path = substr($path, 0, $pos);
        }
        
        $handler = MSharesBase::initSharesBase($path, $root);
        $handler->create();
        $handler->buildResult();
    }

}
?>